<?php
require_once 'includes/funciones.php'; 
conexion(); //Conexion a la base de datos

$id=$_GET['id'];
$tabla=$_GET['t'];

switch($tabla){
    case 'lectura':
	$tablacon = 'gospel';
	break;
		
    case 'noticia':
	$tablacon = 'news';
	break;
}

 $registros=mysql_query("select * from $tablacon where id=$id",$conexion) or die("Problemas en el select:".mysql_error());

 $regcompleto=mysql_fetch_array($registros);
 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Instituto Cardenal Pironio</title>
<meta name="keywords" content="free templates, website templates, CSS, HTML" />
<meta name="description" content="free website template provided by templatemo.com" />
<!-- Free CSS Templates from TemplateMo.com -->
<link href="templatemo_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
  
<div id="templatemo_container">

<?php   
    require 'header.php';  //Llamada al Header
?>
    <div id="templatemo_content"> 
    <?php require 'menu_izquierda.php';?>
	 
    <div id="templatemo_right">
			
    <?php 
	echo '<div class="date">';
	switch($tabla){
            case 'lectura':
		echo '<div class="date">'.cambiarFechaMostrar($regcompleto['date']).'</div><br>';
		echo '</div> <div style="clear:both">';
		echo '<div class="title">'.$regcompleto['title'].'</div><br>';
		echo '<div class="contenido">'.$regcompleto['reading'].'</div><br><br>';
		echo '<div class="title"> Reflexion </div><br>';
		echo '<div class="contenido">'.$regcompleto['reflection'].'</div>';						
		break;
            case 'noticia':
		echo '</div> <div style="clear:both">';
		echo '<div class="title">'.$regcompleto['title'].'</div><br>';
		echo '<div class="date">'.cambiarFechaMostrar($regcompleto['date']).'</div>';
		echo '<br>';
		echo '<div class="contenido">'.$regcompleto['body'].'</div>';	

		$registrosimagen=mysql_query("select * from images where new_id = '$regcompleto[id]' ");
		if(mysql_num_rows($registrosimagen) != 0){
            $regimg = mysql_fetch_array($registrosimagen);
            echo '<img style="margin:15px 0px 0px 100px; border: double 2px" width="350" src="'.$regimg['folder'].$regimg['url'].'" />';
		}
		
		break;
	}
				
    ?>
    </div>
</div>
</div>
<?php require 'foot.php'; ?>
</div>
</body>
</html>